<!DOCTYPE html>
<html>
<head>
    <template file="Home/meta" />
    <template file="Home/css" />









</head>
<body>


<template file="Home/search" />
<template file="Home/slide" />


<div class="am-g am-padding-vertical-sm common-border-bottom  common-border-top am-margin-top-sm  index_cate_product">




    <div class="am-block">


        <ul class="am-avg-sm-2"  id="product_list"></ul>




    </div>


</div>





<button class="am-btn am-btn-hui am-btn-block am-margin-bottom-sm" onclick="add_news(this)">加载更多</button>
<div data-am-widget="navbar" class="am-navbar am-cf am-navbar-index  common-border-top">
    <template file="Home/bottom_nav" />
</div>
<template file="Home/js" />





<script>


    num = 1;

    function add_news(obj) {

        $.post("{:get_now_url()}", { page: num }, function (data) {
            var html = $("#product_list").html();

            if (data!=null) {


                $.each(data, function (news, v) {




                    html += " <li class='am-padding-xs'>";

                    html += "                <div  class='am-img-thumbnail am-padding-xs am-padding-vertical-sm am-block' >";

                    html += "                    <div class='img'>";
                    html += "                        <a href='/Home/Product/show/id/"+ v.id+"'>";
                    html += "                            <img class='am-img-responsive' src='"+ v.thumb+"' alt=''>";
                    html += "                        </a>";

                    html += "                    </div>";
                    html += "                    <a href='' class='title am-block am-text-center am-text-truncate'>"+ v.title+"</a>";
                    html += "                    <span class='price'>"+v.price+"</span>";

                    html += "                </div>";
                    html += "            </li>";




                });

                $("#product_list").html(html);

                num++;
            }
            else {

                $(obj).attr("disabled", "disabled");
                $(obj).html("没有了");
            }

        });


    }
    $(function () {
        add_news();

    })





</script>



</body>
</html>